package com.luoyuanxiangvip.core.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.luoyuanxiangvip.common.annotation.Cache;
import com.luoyuanxiangvip.core.entity.SysUser;
import com.luoyuanxiangvip.core.mapper.SysUserMapper;
import com.luoyuanxiangvip.core.service.ISysUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.concurrent.TimeUnit;

/**
 * <p>
 * 系统用户 服务实现类
 * </p>
 *
 * @author luoyuanxiang <p>luoyuanxiangvip.com</p>
 * @since 2019-05-30
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {

    /**
     * 根据用户名查找
     *
     * @param userName 用户名
     * @return SysUser
     */
    @Override
    @Cache(value = "【user】根据用户名查找",expire = 7, unit = TimeUnit.DAYS)
    public SysUser findByUserName(String userName) {
        return this.baseMapper.findByUserName(userName);
    }
}
